#ifndef SCRIPTMANAGER_H
#define SCRIPTMANAGER_H

#include "scriptmanager.h"
#include <QScriptEngine>

#ifndef QT_NO_SCRIPTTOOLS
    #include <QtScriptTools>
#endif

class QMainWindow;
class QString;

class ScriptManager
{
public:
    QScriptEngine* engine(){return &m_scriptEngine;}
    static ScriptManager *instance();


    void loadScriptFile(QString scriptname);
    void initScriptLibrary();

    void invokeFunction(const QString &funcName);

private:
    void scriptLibraryPaths();
    void initScriptFunctions();
    void registerScriptObjects();

    QScriptEngine m_scriptEngine;
    static ScriptManager *m_instance;

    ScriptManager();

#ifndef QT_NO_SCRIPTTOOLS
public:
    QMainWindow *debugWindow;
    QScriptEngineDebugger debugger;
#endif
};

#endif // SCRIPTMANAGER_H
